package control

import (
	"net/http"
	"pro_cla_sql/model"
	"pro_cla_sql/util"
)

func Course(w http.ResponseWriter, r *http.Request) {
	w.Header().Set(`Content-Type`, `application/json`)
	w.Header().Set(`Access-Control-Allow-Origin`, `*`)
	cid := CSno[0:10]
	// println(cid[0:10])
	// print(sno)
	mod, err := model.CoursesAll(cid)
	if err != nil {
		w.Write(util.NewResult(util.Fail, "课程信息查询失败"))
		return
	} else {
		w.Write(util.NewResult(util.Success, "课程信息查询成功", mod))
		return
	}

}
